
import { Component } from 'react';

import { Boxs,Avatar} from 'saltui';

const { HBox, Box,VBox } = Boxs;
import AngleRight from 'salt-icon/lib/AngleRight';
import DB from '../../../app/db';
import { nodataIcon } from '../../../app/variables';
export default class Page extends Component {
 constructor(props) {
    super(props);
    this.state = {
      relationList:[],
    };
    
  }


 componentDidMount (){
   let t = this;
   t.setState({
   	relationList:[],
   });
   var processInstanceId = this.props.processInstanceId;
   DB.FlowModuleAPI.getRelationProcess({processInstanceId:processInstanceId}).then((content) => {
	   t.setState({
	    	relationList:content,
	    });
    }).catch((error) => {
    	
    });
  }

 clickDetail(item) {
      var processInstanceId = item.processInstanceId;
      var dataId = item.dataId;
      var category = item.categoryCode;
      var formId = item.formId;
      var id = item.taskId;
      //let url = "/process/processDetails/" + id + "/" + formId + "/" + dataId + "/" + type + "/0/" + processInstanceId + "/szydsysmgr/" + category;
      var url = "/process/processDetails/-99/" + formId + "/" + dataId + "/-99/0/" + processInstanceId +"/meeting/" + category;
      //alert(url);
      decodeURI(url);
      location.hash = url;
      //location.reload();
 }


  render() {
    //t-BCf t-PT10 t-PB10
    const t = this;
    return (
      <div className="t-PR" style={{minHeight: 200 + 'px'}}>
          {
            t.state.relationList.map(function(item,i){
            return (
                      <HBox className="t-BCf t-P16 t-PR12 dd-bottom-border" onClick={t.clickDetail.bind(this,item)}>
                      <Box flex={1}>
                        <div className="t-omit t-FC3 t-FS16 t-LH1_3 t-MR8">
                          {item.title}
                        </div>
                        <HBox className="t-FCddfontblue-40 t-LH1_3 t-PT8 t-FS14" vAlign="center">
                          <HBox vAlign="center">
                            <Box><i className="iconfont icon-time t-MR4 t-FS14"></i></Box>
                            <Box><span className="t-omit t-MR26">{item.startTime}</span></Box>
                          </HBox>
                          <HBox flex={1} vAlign="center">
                            <Box><span className='t-list-text t-FCoranger t-omit t-MR4'>{item.startUserName}</span></Box>
                          </HBox>
                        </HBox>
                      </Box>
                      <Box>
                      <AngleRight width={20} fill="#ccc" className="demo-t-list-arrow" />
                      </Box>
                    </HBox>
            )}.bind(this))
        }
          <div className={t.state.relationList.length == 0 ?"nodata-wrapper":"t-DN"}>
	      <VBox vAlign="center" hAlign="center" className="nodata">
	        <Box>
	          <div>
	            <img src={nodataIcon} alt="" style={{width: 68 + 'px'}} />
	          </div>
	        </Box>
	        <Box className="t-FCc">
	               暂无数据
	        </Box>
	      </VBox>
	    </div>
      </div>)       
  }
}


